package pos.domain;
import java.util.List;

import pos.data.JDBCPropertyDAO;
import pos.domain.Property;
import java.util.*;
public class PropertyManager implements IPropertyManager {
	public List<Property> completeSearch(List<String> propertyFields,List<Boolean> serviceFields){
		List<Property> ret = new LinkedList<Property>();
		
		if(propertyFields.size()<6){
			for(int i=propertyFields.size();i<6;i++)
				propertyFields.add(" ");
		}
		if(serviceFields.size()<8){
			for(int i=serviceFields.size();i<8;i++)
				serviceFields.add(new Boolean(true));
		}
		ret=this.searchByPropertiesFields(propertyFields, serviceFields);
		System.out.println(ret.toString());
		return ret;
	}
	
	public List<Property> searchByServices(List<Boolean>search){
		return(new JDBCPropertyDAO().selectPropertyByService(search));
	}
	public List<Property> searchByPropertiesFields(List<String> search,List<Boolean> bsearch){
		return (new JDBCPropertyDAO()).selectPropertyByFields(search,bsearch);
	}
	
	
	public List<Property> newestProperties(){
		
		return (new JDBCPropertyDAO()).sortByNewestProperties();
	}
	
	public List<Property> topRatedProperties(){
		
		return (new JDBCPropertyDAO()).sortByTopRatedProperties();
	
	}
	public Property selectProperty(String pid){
		
		return (new JDBCPropertyDAO()).select(pid);
		
	}
			
}
